/*
 * @Descripttion: GGB
 * @version: 1.0
 * @Author: GGB
 * @Date: 2021-08-05 07:10:18
 * @LastEditors: GGB
 * @LastEditTime: 2021-08-24 19:01:07
 */

import 'package:flutter/material.dart';
import 'package:flutter_inner_drawer/inner_drawer.dart';
import '../../constrans.dart';
import 'components/bottom_nav.dart';
import 'components/message_body.dart';
import 'components/top_menu.dart';

class HomeScreen extends StatefulWidget {
  const HomeScreen({Key key}) : super(key: key);

  @override
  _HomeScreenState createState() => _HomeScreenState();
}

class _HomeScreenState extends State<HomeScreen> {
  final GlobalKey<InnerDrawerState> _innerDramerKey =
      GlobalKey<InnerDrawerState>();
  bool isToggle = false;
  bool isEnter = false;
  bool isOpen = false;
  double roomBottomSheetHeight = 52.0;

  void _toggle() {
    _innerDramerKey.currentState?.toggle(direction: InnerDrawerDirection.end);
  }

  @override
  Widget build(BuildContext context) {
    // return BackdropScaffold(
    //   headerHeight: 58,
    //   backgroundColor: appBackgroundColor,
    //   appBar: BackdropAppBar(
    //     title: Text("Backdrop Example"),
    //     actions: <Widget>[
    //       BackdropToggleButton(
    //         icon: AnimatedIcons.list_view,
    //       )
    //     ],
    //   ),
    //   backLayer: Center(
    //     child: Text("Back Layer"),
    //   ),
    //   frontLayer: Center(
    //     child: Text("Front Layer"),
    //   ),
    // );
    return Scaffold(
      backgroundColor: appBackgroundColor,
      body: SafeArea(
        child: Stack(
          children: [
            TopMenu(
              isOpen: isOpen,
              onTap: () {
                if (isOpen) {
                  isOpen = false;
                }
                setState(() {
                  roomBottomSheetHeight = 52.0;
                });
              },
            ),
            MessageBody(),
            BottomNav(
                height: roomBottomSheetHeight,
                isOpen: isOpen,
                onTap: () {
                  if (!isOpen) {
                    isOpen = true;
                    roomBottomSheetHeight =
                        MediaQuery.of(context).size.height / 1.16;
                  }
                  setState(() {});
                }),
          ],
        ),
      ),
    );
  }
}
